In order to get high quality CT or PET (Positron Emission Tomography) images, detectors with good properties are required. Conventionally, the refractive index of the coupling material between a light-emitting component, such as scintillator, and a photosensor, such as a photomultiplier tube (PMT), is smaller than the ideal or desired index. Also, since the material composition is uniform, the refractive index throughout the coupling region is uniform. Due to the refractive index mismatch between the light-emitting component and the photosensor, some of the scintillation light needs a relatively long time to get out of the scintillator, and some of scintillation light is trapped and lost in the scintillator. As a result, the number of photons detected by the photosensor is not as high as it should be, and photons do not reach the detector as fast as they should. This degrades the energy resolution and timing resolution of the detector. Traditionally, the light-emitting part and the photosensor are coupled with a material having a preset refractive index, which is not optimized to reduce light loss for each particular scanning application.